<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
	request.setCharacterEncoding("UTF-8"); 

	String I_E_TEL = request.getParameter("E_TEL");
	String I_E_TEL1 = request.getParameter("E_TEL1");



	String I_PERNR = request.getParameter("I_PERNR");
	String E_ENAME = request.getParameter("E_ENAME");
	String E_BIRDT = request.getParameter("E_BIRDT");
	String E_WORKPLACE = request.getParameter("E_WORKPLACE");
	String E_BIZNO = request.getParameter("E_BIZNO");
	String E_REGNO = request.getParameter("E_REGNO");
	String E_BIZPLACE = request.getParameter("E_BIZPLACE");
	String E_BIZPLACE2 = request.getParameter("E_BIZPLACE2");
	
	String E_10 = request.getParameter("E_10");
	String E_20 = request.getParameter("E_20");
	String E_21 = request.getParameter("E_21");
	String E_30 = request.getParameter("E_30");
	String E_31 = request.getParameter("E_31");
	String E_40 = request.getParameter("E_40");
	String E_41 = request.getParameter("E_41");
	String E_42 = request.getParameter("E_42");
	String E_50 = request.getParameter("E_50");
	
	final int MAX_COUNT = 9;
	String COUNT = request.getParameter("COUNT");
	int count = Integer.parseInt(COUNT);
	if(count > MAX_COUNT)	count = MAX_COUNT;

	String [] ZTYPE = new String[count];
	String [] ZCODE = new String[count];	
	String [] DESC = new String[count];		
	String [] DDATE = new String[count];		
	String [] BIZTX = new String[count];		
	String [] BIZNO = new String[count];	
	String [] DOAMT = new String[count];	
	String [] DOCNT = new String[count];	
	String [] RELAT = new String[count];		
	String [] ENAME = new String[count];		
	String [] REGNO = new String[count];	
	
	for(int i=0; i<count; ++i) {
	  	ZTYPE[i] = request.getParameter("ZTYPE" + Integer.toString(i)) == null ? "" : request.getParameter("ZTYPE" + Integer.toString(i));
	  	ZCODE[i] = request.getParameter("ZCODE" + Integer.toString(i)) == null ? "" : request.getParameter("ZCODE" + Integer.toString(i));	
	  	DESC[i] = request.getParameter("DESC" + Integer.toString(i)) == null ? "" : request.getParameter("DESC" + Integer.toString(i));	
	  	DDATE[i] = request.getParameter("DDATE" + Integer.toString(i)) == null ? "" : request.getParameter("DDATE" + Integer.toString(i));		
	  	BIZTX[i] = request.getParameter("BIZTX" + Integer.toString(i)) == null ? "" : request.getParameter("BIZTX" + Integer.toString(i));	
	  	BIZNO[i] = request.getParameter("BIZNO" + Integer.toString(i)) == null ? "" : request.getParameter("BIZNO" + Integer.toString(i));	
	  	DOCNT[i] = request.getParameter("DOCNT" + Integer.toString(i)) == null ? "" : request.getParameter("DOCNT" + Integer.toString(i));	
	  	DOAMT[i] = request.getParameter("DOAMT" + Integer.toString(i)) == null ? "" : request.getParameter("DOAMT" + Integer.toString(i));	
	  	RELAT[i] = request.getParameter("RELAT" + Integer.toString(i)) == null ? "" : request.getParameter("RELAT" + Integer.toString(i));		
	  	ENAME[i] = request.getParameter("ENAME" + Integer.toString(i)) == null ? "" : request.getParameter("ENAME" + Integer.toString(i));		
	  	REGNO[i] = request.getParameter("REGNO" + Integer.toString(i)) == null ? "" : request.getParameter("REGNO" + Integer.toString(i));	
	}

	String SUM_COUNT = request.getParameter("SUM_COUNT");
	int sum_count = Integer.parseInt(SUM_COUNT);

	String [] LINE = new String[7];
	String [] TOTAL = new String[7];	
	String [] M10 = new String[7];		
	String [] M20 = new String[7];		
	String [] M30 = new String[7];		
	String [] M31 = new String[7];	
	String [] M40 = new String[7];	
	String [] M41 = new String[7];	
	String [] M42 = new String[7];		
	String [] M50 = new String[7];		

	for(int j=0; j<7; ++j) {
		LINE[j] = request.getParameter("LINE" + Integer.toString(j)) == null ? "" : request.getParameter("LINE" + Integer.toString(j));
		TOTAL[j] = request.getParameter("TOTAL" + Integer.toString(j)) == null ? "" : request.getParameter("TOTAL" + Integer.toString(j));	
		M10[j] = request.getParameter("M10" + Integer.toString(j)) == null ? "" : request.getParameter("M10" + Integer.toString(j));	
		M20[j] = request.getParameter("M20" + Integer.toString(j)) == null ? "" : request.getParameter("M20" + Integer.toString(j));		
		M30[j] = request.getParameter("M30" + Integer.toString(j)) == null ? "" : request.getParameter("M30" + Integer.toString(j));	
		M31[j] = request.getParameter("M31" + Integer.toString(j)) == null ? "" : request.getParameter("M31" + Integer.toString(j));	
		M40[j] = request.getParameter("M40" + Integer.toString(j)) == null ? "" : request.getParameter("M40" + Integer.toString(j));	
		M41[j] = request.getParameter("M41" + Integer.toString(j)) == null ? "" : request.getParameter("M41" + Integer.toString(j));	
		M42[j] = request.getParameter("M42" + Integer.toString(j)) == null ? "" : request.getParameter("M42" + Integer.toString(j));		
		M50[j] = request.getParameter("M50" + Integer.toString(j)) == null ? "" : request.getParameter("M50" + Integer.toString(j));		
	}

	String COUNTAdj = request.getParameter("COUNTAdj");
	int iCOUNTAdj 	= Integer.parseInt(COUNTAdj);	
	
	String [] CODE            = new String[iCOUNTAdj];
	String [] YEAR            = new String[iCOUNTAdj];
	String [] DON_AMT         = new String[iCOUNTAdj];
	String [] PREV_DED_AMT    = new String[iCOUNTAdj];
	String [] DEDUCTIBLE_AMT  = new String[iCOUNTAdj];
	String [] CURR_DED_AMT    = new String[iCOUNTAdj];
	String [] EXPIRED_AMT     = new String[iCOUNTAdj];
	String [] CARRYOVER_AMT   = new String[iCOUNTAdj];

	for(int i=0; i<iCOUNTAdj; ++i) {
		CODE[i] = request.getParameter("CODE" + Integer.toString(i)) == null ? "" : request.getParameter("CODE" + Integer.toString(i));
		YEAR[i] = request.getParameter("YEAR" + Integer.toString(i)) == null ? "" : request.getParameter("YEAR" + Integer.toString(i));
		DON_AMT[i] = request.getParameter("DON_AMT" + Integer.toString(i)) == null ? "" : request.getParameter("DON_AMT" + Integer.toString(i));
		PREV_DED_AMT[i] = request.getParameter("PREV_DED_AMT" + Integer.toString(i)) == null ? "" : request.getParameter("PREV_DED_AMT" + Integer.toString(i));
		DEDUCTIBLE_AMT[i] = request.getParameter("DEDUCTIBLE_AMT" + Integer.toString(i)) == null ? "" : request.getParameter("DEDUCTIBLE_AMT" + Integer.toString(i));
		CURR_DED_AMT[i] = request.getParameter("CURR_DED_AMT" + Integer.toString(i)) == null ? "" : request.getParameter("CURR_DED_AMT" + Integer.toString(i));
		EXPIRED_AMT[i] = request.getParameter("EXPIRED_AMT" + Integer.toString(i)) == null ? "" : request.getParameter("EXPIRED_AMT" + Integer.toString(i));
		CARRYOVER_AMT[i] = request.getParameter("CARRYOVER_AMT" + Integer.toString(i)) == null ? "" : request.getParameter("CARRYOVER_AMT" + Integer.toString(i));
	}

%>

    
<html>
<head>
<title>
기부금 명세서
</title>


<style>
	td{font-size:10px;}
	.td_d1{
		font-size:16px;
		font-weight:bold;
	}
</style>


<script language="javascript">

	function Print(){
   		document.all.ptLayer.style.display="none";
   		//  self.printing.leftMargin = 1.0 // 왼쪽 여백 사이즈
   		//  factory.printing.topMargin = 1.0 // 위 여백 사이즈
   		//  self.printing.topMargin
   		//  self.printing.rightMargin = 1.0 // 오른쪽 여백 사이즈
   		//  self.printing.bottomMargin = 1.0 // 아래 여백 사이즈
    	self.print();
    	document.all.ptLayer.style.display="block";
	}

</script>
</head>


<body leftmargin="10" topmargin="60" marginwidth="0" marginheight="0" align="center">


<FORM name="webguiform" method=post>

<!--   HEADER   -->
<table width="710" border="0" cellspacing="0" cellpadding="0" height="10">
  <tr> 
  	<td width="510" align="left">&nbsp;■ 소득세법 시행규칙 [별지 제45호 서식]</td>
    <td width="200" height="20" align="right" valign="bottom" class="td_f3" > 
      <table width="100%" border="1" cellspacing="0" cellpadding="0"  bordercolor="000000" style="border-collapse:collapse;border-width:0.5px;">
        <tr align="center"> 
          <td width="50%" height="20" style="border-bottom-width:0;">사번</td>
          <td width="50%" height="20" style="border-bottom-width:0;"><%= I_PERNR%></td>
        </tr>
      </table></td>
  </tr>
</table> 
<!--   표시작   -->
<table width="710" cellspacing="0" cellpadding="0" border="1"  bordercolor="000000" style="border-collapse:collapse;border- width:1px;">
  <tr> 
    <td valign="top"> 
	 <!--   개인 기본정보 시작    -->
      <table width="100%" border="1" cellspacing="0" cellpadding="4" bordercolor="000000" style="border-collapse:collapse;border -width:1px;">
        <tr> 
          <td height="38" colspan="4" align="center" style="letter-spacing:-1pt" class="td_d1">기 부 금 명 세 서</td>
        </tr>
        <tr> 
          <td height="30" colspan="4" align="left" style="letter-spacing:-1pt" class="td_d2"><b>1. 인적사항</b></td>
        </tr>
        <tr> 
          <td width="15%" height="25" align="center"> ①근무지 또는 사업장 상호</td>
          <td width="35%" ><%= E_WORKPLACE%></td>
          <td width="15%"  align="center"> ②사업자등록번호</td>
          <td width="35%" align="center"><%= E_BIZNO%></td>
        </tr>
       <tr> 
          <td   align="center">③성 명 </td>
          <td><%= E_ENAME%></td>
          <td  align="center"> ④주민등록번호</td>
          <td   align="center"><%= E_REGNO%></td>
        </tr>
        <tr> 
          <td height="25" align="center"> ⑤주 소</td>
          <td  colspan="3"> <%= E_BIZPLACE%>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(전화번호:<%= I_E_TEL%>)</td>
        </tr>
          <tr> 
          <td height="25" align="center">⑥사업장소재지</td>
          <td height="19" colspan="3"> <%= E_BIZPLACE2%>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(전화번호:<%= I_E_TEL1%>) </td>
        </tr>
      </table>
	  <!--   개인 기본정보 끝    -->
      <!--   기부내용 시작    -->
      <table width="100%" border="1" cellpadding="3" cellspacing="0" bordercolor="000000" style="border-collapse:collapse;border -width:1px;">
        <tr> 
          <td height="30" colspan="10" align="left" style="letter-spacing:-1pt" class="td_d2"><b>2. 해당연도 기부 명세</b></td>
        </tr>
        <tr> 
          <td colspan="2" align="center">구분</td> 
          <td width="55" rowspan="2" align="center">⑨기부내용</td>
          <td colspan="2" align="center">기부처</td>
          <td colspan="3" align="center">⑫기부자</td>
          <td colspan="2" align="center">⑬기부내역</td>
        </tr>
        <tr> 
          <td width="110" align="center">⑦유형</td>
          <td width="40" align="center">⑧코드</td>
          <td width="100" align="center">⑩상호(법인명)</td>
          <td width="100" align="center">⑪사업자<br>등록번호 등</td>
          <td width="40"  align="center">관계<br>코드</td>
          <td width="50"  align="center">성명</td>
          <td width="80" align="center">주민<br>등록번호</td>
          <td width="30"  align="center">건수</td>
          <td width="80" align="center">금액</td>
        </tr>

<!-------------------  

  TR 로 끝남 TABLE 이 완성 되어서 끝나는것 아님으로 확인 작업시 전부 하나로 합쳐서 할것

--------------------->

<!--   BODY   -->
<!--  본문 테이블 Content-->
 
<% 
	for(int i=0; i<count; ++i) {
%>
        <tr> 
          <td align="center" class="td_t_2"><%= ZTYPE[i]%> </td>
          <td align="center" class="td_t_2"><%= ZCODE[i]%></td>
          <td align="center" class="td_t_2"><%= DESC[i]%></td>
          <td align="center" class="td_t_2"><%= BIZTX[i]%></td>
          <td align="center" class="td_t_2"><%= BIZNO[i]%></td>
          <td align="center" class="td_t_2"><%= RELAT[i]%></td>
          <td align="center" class="td_t_2"><%= ENAME[i]%></td>
          <td align="center" class="td_t_2"><%= REGNO[i]%></td>
          <td align="right" class="td_t_1"><%= DOCNT[i]%></td>
          <td align="right" class="td_t_1"><%= DOAMT[i]%></td>
        </tr>
<% 
	}
	for(int j = 0; j < MAX_COUNT-count; ++j ) {
%>

        <tr> 
          <td class="td_t_2">&nbsp; </td>
          <td align="center" class="td_t_2">&nbsp;</td>
          <td class="td_t_2">&nbsp;</td>
          <td align="center" class="td_t_2">&nbsp;</td>
          <td align="center" class="td_t_2">&nbsp;</td>
          <td align="center" class="td_t_2">&nbsp;</td>
          <td align="right" class="td_t_1">&nbsp;</td>
          <td align="center" class="td_t_2">&nbsp;</td>
          <td align="center" class="td_t_2">&nbsp;</td>
          <td align="center" class="td_t_2">&nbsp;</td>
        </tr>
       
<% 
	}
%>
  </table>
	  <!--   기부내용  끝    -->

	  <!--   개인 기본정보 끝    -->
      <!--   기부내용 시작    -->
      <table width="100%" border="1" cellpadding="3" cellspacing="0" bordercolor="000000" style="border-collapse:collapse;border -width:1px;">
        <tr> 
          <td height="30" colspan="8" align="left" style="letter-spacing:-1pt" class="td_d2"><b>3. 구분코드별 기부금의 합계</b></td>
        </tr>
        <tr> 
          <td rowspan="2" align="center">기부자<br>구분</td>
          <td rowspan="2" align="center">총계</td>
          <td colspan="5" align="center">공제대상기부금</td>
          <td rowspan="2" align="center">공제제외기부금</td>
        </tr>
        <tr> 
          <td align="center">법정<br>기부금</td>
          <td align="center">정치자금<br>기부금</td>
<!--          <td align="center">특례<br>기부금</td>-->
<!--          <td align="center">공익법인<br>신탁기부금</td>-->
          <td align="center">종교단체외<br>지정기부금</td>
          <td align="center">종교단체<br>지정기부금</td>
          <td align="center">우리사주조<br>합 기부금</td>
        </tr>
        <tr> 
          <td align="center">코드</td>
          <td align="center">&nbsp;</td>
          <td align="center">10</td>
          <td align="center">20</td>
<!--          <td align="center">30</td>-->
<!--          <td align="center">31</td>-->
          <td align="center">40</td>
          <td align="center">41</td>
          <td align="center">42</td>
          <td align="center">50</td>
        </tr>
        <tr> 
          <td align="center">합계</td>
          <td align="right">&nbsp;<%=TOTAL[0]%></td>
          <td align="right">&nbsp;<%=M10[0]%></td>
          <td align="right">&nbsp;<%=M20[0]%></td>
<!--          <td align="right">&nbsp;<%=M30[0]%></td>-->
<!--          <td align="right">&nbsp;<%=M31[0]%></td>-->
          <td align="right">&nbsp;<%=M40[0]%></td>
          <td align="right">&nbsp;<%=M41[0]%></td>
          <td align="right">&nbsp;<%=M42[0]%></td>
          <td align="right">&nbsp;<%=M50[0]%></td>
        </tr>
        <tr> 
          <td align="center">본인</td>
          <td align="right">&nbsp;<%=TOTAL[1]%></td>
          <td align="right">&nbsp;<%=M10[1]%></td>
          <td align="right">&nbsp;<%=M20[1]%></td>
<!--          <td align="right">&nbsp;<%=M30[1]%></td>-->
<!--          <td align="right">&nbsp;<%=M31[1]%></td>-->
          <td align="right">&nbsp;<%=M40[1]%></td>
          <td align="right">&nbsp;<%=M41[1]%></td>
          <td align="right">&nbsp;<%=M42[1]%></td>
          <td align="right">&nbsp;<%=M50[1]%></td>
        </tr>
        <tr> 
          <td align="center">배우자</td>
          <td align="right">&nbsp;<%=TOTAL[2]%></td>
          <td align="right">&nbsp;<%=M10[2]%></td>
          <td align="right">&nbsp;<%=M20[2]%></td>
<!--          <td align="right">&nbsp;<%=M30[2]%></td>-->
<!--          <td align="right">&nbsp;<%=M31[2]%></td>-->
          <td align="right">&nbsp;<%=M40[2]%></td>
          <td align="right">&nbsp;<%=M41[2]%></td>
          <td align="right">&nbsp;<%=M42[2]%></td>
          <td align="right">&nbsp;<%=M50[2]%></td>
        </tr>
        <tr> 
          <td align="center">직계비속</td>
          <td align="right">&nbsp;<%=TOTAL[3]%></td>
          <td align="right">&nbsp;<%=M10[3]%></td>
          <td align="right">&nbsp;<%=M20[3]%></td>
<!--          <td align="right">&nbsp;<%=M30[3]%></td>-->
<!--          <td align="right">&nbsp;<%=M31[3]%></td>-->
          <td align="right">&nbsp;<%=M40[3]%></td>
          <td align="right">&nbsp;<%=M41[3]%></td>
          <td align="right">&nbsp;<%=M42[3]%></td>
          <td align="right">&nbsp;<%=M50[3]%></td>
        </tr>
        
        <!-- 2012.01.04 -->
        <tr> 
          <td align="center">직계존속</td>
          <td align="right">&nbsp;<%=TOTAL[4]%></td>
          <td align="right">&nbsp;<%=M10[4]%></td>
          <td align="right">&nbsp;<%=M20[4]%></td>
<!--          <td align="right">&nbsp;<%=M30[4]%></td>-->
<!--          <td align="right">&nbsp;<%=M31[4]%></td>-->
          <td align="right">&nbsp;<%=M40[4]%></td>
          <td align="right">&nbsp;<%=M41[4]%></td>
          <td align="right">&nbsp;<%=M42[4]%></td>
          <td align="right">&nbsp;<%=M50[4]%></td>
        </tr>
        <tr> 
          <td align="center">형제자매</td>
          <td align="right">&nbsp;<%=TOTAL[5]%></td>
          <td align="right">&nbsp;<%=M10[5]%></td>
          <td align="right">&nbsp;<%=M20[5]%></td>
<!--          <td align="right">&nbsp;<%=M30[5]%></td>-->
<!--          <td align="right">&nbsp;<%=M31[5]%></td>-->
          <td align="right">&nbsp;<%=M40[5]%></td>
          <td align="right">&nbsp;<%=M41[5]%></td>
          <td align="right">&nbsp;<%=M42[5]%></td>
          <td align="right">&nbsp;<%=M50[5]%></td>
        </tr>
        <tr> 
          <td align="center">그 외</td>
          <td align="right">&nbsp;<%=TOTAL[6]%></td>
          <td align="right">&nbsp;<%=M10[6]%></td>
          <td align="right">&nbsp;<%=M20[6]%></td>
<!--          <td align="right">&nbsp;<%=M30[6]%></td>-->
<!--          <td align="right">&nbsp;<%=M31[6]%></td>-->
          <td align="right">&nbsp;<%=M40[6]%></td>
          <td align="right">&nbsp;<%=M41[6]%></td>
          <td align="right">&nbsp;<%=M42[6]%></td>
          <td align="right">&nbsp;<%=M50[6]%></td>
        </tr>                        
	</table>

      <table width="100%" border="1" cellpadding="3" cellspacing="0" bordercolor="000000" style="border-collapse:collapse;border -width:1px;">
        <tr> 
          <td height="30" colspan="8" align="left" style="letter-spacing:-1pt" class="td_d2"><b>4. 기부금 조정 명세</b></td>
        </tr>
        <tr> 
          <td rowspan="2" align="center">기부금코드</td>
          <td rowspan="2" align="center">기부연도</td>
          <td rowspan="2" align="center">⑭기부금액</td>
          <td rowspan="2" align="center">⑮전년까지<br>공제된 금액</td>
          <td rowspan="2" align="center">(16)공제대상<br>금액(⑭ - ⑮)</td>
          <td rowspan="2" align="center">해당연도<br>공제금액</td>
          <td colspan="2" align="center">해당연도에 공제받지 못한 금액</td>
        </tr>
        <tr> 
          <td align="center">소멸금액</td>
          <td align="center">이월금액</td>
        </tr>

<% 
	for(int i=0; i<iCOUNTAdj; ++i) {
%>
        <tr> 
          <td align="center"><%= CODE[i]%> </td>
          <td align="center"><%= YEAR[i]%> </td>
          <td align="right"><%= DON_AMT[i]%> </td>          
          <td align="right"><%= PREV_DED_AMT[i]%> </td>
          <td align="right"><%= DEDUCTIBLE_AMT[i]%> </td>
          <td align="right"><%= CURR_DED_AMT[i]%> </td>
          <td align="right"><%= EXPIRED_AMT[i]%> </td>
          <td align="right"><%= CARRYOVER_AMT[i]%> </td>
        </tr>                    
<% 
	}
%>        
<!-- 
        <tr> 
          <td align="center">&nbsp;</td>
          <td align="center">&nbsp;</td>
          <td align="center">&nbsp;</td>
          <td align="center">&nbsp;</td>
          <td align="center">&nbsp;</td>
          <td align="center">&nbsp;</td>
          <td align="center">&nbsp;</td>
          <td align="center">&nbsp;</td>
        </tr>
-->         
	</table>


	<!--   소계/ 계 끝   



   </td>
  </tr>
</table>
<!--   표 끝   -->


<!-- BUTTON_DOWN -->
<!--   버튼 이 미지 시작   -->

<br/>

     <div id="ptLayer">
      <table width="100%" border="0" cellspacing="1" cellpadding="1">
        <!-- `Title_Bottom_Blank()` -->
        <tr> 
          <td><div align="center">
               <button onclick="Print()">명세서출력</button>
          </td>
        </tr>
        <!-- `Title_Bottom_Blank()` -->
      </table>
     </div>
      <!--    버 튼 이미지 끝    --> 



</form>


</body>
</html>